package com.atguigu.auth.service.Impl;

import com.atguigu.auth.mapper.OaProcessRecordMapper;
import com.atguigu.auth.service.OaProcessRecordService;
import com.atguigu.auth.service.SysUserService;
import com.atguigu.model.process.ProcessRecord;
import com.atguigu.model.system.SysUser;
import com.atguigu.security.custom.LoginUserInfoHelper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 12646
 * @description 针对表【oa_process_record(审批记录)】的数据库操作Service实现
 * @createDate 2023-11-22 14:43:37
 */
@Service
public class OaProcessRecordServiceImpl extends ServiceImpl<OaProcessRecordMapper, ProcessRecord>
    implements OaProcessRecordService {
  @Autowired
  private OaProcessRecordMapper processRecordMapper;
  
  @Autowired
  private SysUserService sysUserService;
  
  @Override
  public void record(Long processId, Integer status, String description) {
    SysUser sysUser = sysUserService.getById(LoginUserInfoHelper.getUserId());
    ProcessRecord processRecord = new ProcessRecord();
    processRecord.setProcessId(processId);
    processRecord.setStatus(status);
    processRecord.setDescription(description);
    processRecord.setOperateUserId(sysUser.getId());
    processRecord.setOperateUser(sysUser.getName());
    processRecordMapper.insert(processRecord);
  }
}




